from PyCmpltrtok.common import sep
sep()
import numpy as np

a = np.array([1, 2, 3, 4])
b = np.array([5, 6, 7])

zipped = zip(a, b)

for x, y in zipped:
    print(x, y)

sep()
import itertools

a = np.array([1, 2, 3, 4])
b = np.array([5, 6, 7])

zipped = zip(a, itertools.cycle(b))

for x, y in zipped:
    print(x, y)

sep()
a = np.array([1, 2, 3, 4])
b = np.array([5, 6, 7])

zipped = dict(zip(a, b))

for key, value in zipped.items():
    print(key, value)

sep()
def dl2ld(dl):
    """
    https://stackoverflow.com/questions/5558418/list-of-dicts-to-from-dict-of-lists

    :param dl:
    :return:
    """
    return [dict(zip(dl.keys(), t)) for t in zip(*dl.values())]


def ld2dl(ld):
    """
    https://stackoverflow.com/questions/5558418/list-of-dicts-to-from-dict-of-lists

    :param ld:
    :return:
    """
    return {k: [dic[k] for dic in ld] for k in ld[0]}


dl = {
    'a': [1, 2, 3],
    'b': [11, 22, 33],
    'c': [111, 222, 333],
}
print(dl2ld(dl))

sep()
xdict = {
    'a': 1,
    'b': 2,
    'c': 3
}
xlist = [11, 22, 33]
print(list(zip(xdict, xlist)))
print(list(zip(xdict.keys(), xlist)))
print(list(zip(xdict.values(), xlist)))
print(list(zip(xdict.items(), xlist)))
